package com.bluetrum.devicemanager.models;

import androidx.annotation.NonNull;

public class SinglePoint {

    public static final int CONNECTION_STATE_DISCONNECTED   = 0;
    public static final int CONNECTION_STATE_CONNECTED      = 1;

    private final byte[] address;
    private final String bluetoothName;
    private final int connectionState;

    public SinglePoint(@NonNull byte[] address,
                       @NonNull String bluetoothName,
                       int connectionState) {
        this.address = address;
        this.bluetoothName = bluetoothName;
        this.connectionState = connectionState;
    }

    @NonNull
    public byte[] getAddressBytes() {
        return address;
    }

    @NonNull
    public String getAddress() {
        return String.format("%02X:%02X:%02X:%02X:%02X:%02X",
                address[0], address[1], address[2], address[3], address[4], address[5]);
    }

    @NonNull
    public String getBluetoothName() {
        return bluetoothName;
    }

    public boolean isConnected() {
        return connectionState == CONNECTION_STATE_CONNECTED;
    }
}
